//
//  LeftDeviceCell.swift
//  HealthMonitoring
//
//  Created by 珠海正杰 on 2018/7/11.
//  Copyright © 2018年 YTYanK. All rights reserved.
//

import UIKit
import SwiftyJSON

class LeftDeviceCell: HMTableViewCell {

    
    let LDC_icon = UIImageView()
    let LDC_text = UILabel()
    
    override func setupViews(view: UIView) {
        // 需要图icon
        view.addSubview(LDC_icon)
        view.addSubview(LDC_text)

        LDC_icon.leadingAlign(view: view, predicate: "8")
        LDC_icon.centerYAlign(view: view)
        LDC_icon.constrainWidth("40")
        LDC_icon.constrainHeight("40")
        
        LDC_text.leadingHorizontally(view: LDC_icon, predicate: "20")
        LDC_text.centerYAlign(view: view)
        LDC_text.trailingAlign(view: view)
//        LDC_text.backgroundColor = UIColor.blue
        
        self.addLayer(isAddLayer: (false, false, false, true), color: configure.shareConfigure.HMColor2, crude: 1.0, layout: (w: self.wWidth, h: self.wHeight + 5))
    }
    
    override func setJson(json: JSON) {
        LDC_text.text = json["title"].stringValue
        LDC_icon.image = UIImage(named: json["icon"].stringValue)
    }

    
    override func setSelected(_ selected: Bool, animated: Bool) {
        if selected {
            self.backgroundColor = configure.shareConfigure.HMColor2
        }else {
            self.backgroundColor = UIColor.white
        }
    }
    
//    override func awakeFromNib() {
//        super.awakeFromNib()
//        // Initialization code
//    }
//
//    override func setSelected(_ selected: Bool, animated: Bool) {
//        super.setSelected(selected, animated: animated)
//
//        // Configure the view for the selected state
//    }
    
}
